﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using System.ServiceModel;
using NTTDATA.BEENChina.ResultCertification.WcfServiceLibrary;

namespace NTTDATA.BEENChina.ResultCertification.Host
{
    public partial class FormMain : Form
    {
        public ServiceHost ServiceEntry = null;
        public ServiceHost ServiceResultCertification = null;
        public ServiceHost ServiceProcessLog = null;
        public FormMain()
        {
            InitializeComponent();
        }

        private void Form1_Load(object sender, EventArgs e)
        {

        }

        private void btnStart_Click(object sender, EventArgs e)
        {
            if (ServiceEntry != null)
            {
                ServiceEntry.Close();
            }
            ServiceEntry = new ServiceHost(typeof(NTTDATA.BEENChina.ResultCertification.WcfServiceLibrary.ServiceEntry));
            ServiceEntry.Open();


            if (ServiceResultCertification != null)
            {
                ServiceResultCertification.Close();
            }
            ServiceResultCertification = new ServiceHost(typeof(NTTDATA.BEENChina.ResultCertification.WcfServiceLibrary.ServiceResultCertification));
            ServiceResultCertification.Open();

            if (ServiceProcessLog != null)
            {
                ServiceProcessLog.Close();
            }
            ServiceProcessLog = new ServiceHost(typeof(NTTDATA.BEENChina.ResultCertification.WcfServiceLibrary.ProcessLog));
            ServiceProcessLog.Open();
        }

        private void btnStop_Click(object sender, EventArgs e)
        {
            if (ServiceEntry != null)
            {
                ServiceEntry.Close();
                ServiceEntry = null;
            }
            if (ServiceResultCertification != null)
            {
                ServiceResultCertification.Close();
                ServiceResultCertification = null;
            }


            if (ServiceProcessLog != null)
            {
                ServiceProcessLog.Close();
                ServiceProcessLog = null;
            }

            this.Close();
        }


    }
}
